Improve error messages in trackfilter for bad data. Try to provide some
authorrobertl <robertl>
Sun, 11 Apr 2010 22:43:33 +0000 (22:43 +0000)
committerrobertl <robertl>
Sun, 11 Apr 2010 22:43:33 +0000 (22:43 +0000)
context.

trackfilter.c

index 2ea676e447cb2e17fc78dcf334ca3705c69c28c5..118425b6be47bccc129d753687edd2f7786dae3a 100644 (file)
@@ -40,6 +40,7 @@
 #include "filterdefs.h"
 #include "strptime.h"
 #include "grtcirc.h"
+#include "xmlgeneric.h"
 
 #if FILTERS_ENABLED
 #define MYNAME "trackfilter"
@@ -266,8 +267,10 @@ trackfilter_fill_track_list_cb(const route_head *track)    /* callback for track_d
            track_pts++;
            
            wpt = (waypoint *)elem;
-           is_fatal((need_time != 0) && (wpt->creation_time == 0),
-               MYNAME "-init: Found track point without time!");
+           if((need_time != 0) && (wpt->creation_time == 0)) {
+             fatal(MYNAME "-init: Found track point at %f,%f without time!\n",
+                    wpt->latitude, wpt->longitude);
+            }
 
            i++;
            if (i == 1) 
@@ -278,8 +281,12 @@ trackfilter_fill_track_list_cb(const route_head *track)    /* callback for track_d
                
            if ((need_time != 0) && (prev != NULL) && (prev->creation_time > wpt->creation_time))
            {
-               if (opt_merge == NULL)
-                   fatal(MYNAME "-init: Track points badly ordered (timestamp)!\n");
+               if (opt_merge == NULL) {
+                    char t1[64], t2[64];
+                    xml_fill_in_time(t1, prev->creation_time, 0, XML_LONG_TIME);
+                    xml_fill_in_time(t2, wpt->creation_time, 0, XML_LONG_TIME);
+                   fatal(MYNAME "-init: Track points badly ordered (timestamp %s > %s)!\n", t1, t2);
+                    }
            }
            prev = wpt;
        }